package edu.unf.cen6940.service;

import edu.unf.cen6940.domain.Faculty;
import edu.unf.cen6940.domain.Thesis;
import edu.unf.cen6940.domain.Thesiscommittee;

import java.util.List;
import java.util.Set;

import org.junit.Test;

import org.junit.runner.RunWith;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.beans.factory.support.DefaultListableBeanFactory;

import org.springframework.context.ApplicationContext;

import org.springframework.mock.web.MockHttpServletRequest;

import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestExecutionListeners;

import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import org.springframework.test.context.support.DependencyInjectionTestExecutionListener;
import org.springframework.test.context.support.DirtiesContextTestExecutionListener;

import org.springframework.test.context.transaction.TransactionalTestExecutionListener;

import org.springframework.transaction.annotation.Transactional;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.RequestScope;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.context.request.SessionScope;

/**
 * Class to run the service as a JUnit test. Each operation in the service is a separate test.
 *
 */

@RunWith(SpringJUnit4ClassRunner.class)
@TestExecutionListeners({
		DependencyInjectionTestExecutionListener.class,
		DirtiesContextTestExecutionListener.class,
		TransactionalTestExecutionListener.class })
@ContextConfiguration(locations = {
		"file:./resources/rms_test-security-context.xml",
		"file:./resources/rms_test-service-context.xml",
		"file:./resources/rms_test-dao-context.xml",
		"file:./resources/rms_test-web-context.xml" })
@Transactional
public class ThesiscommitteeServiceTest {

	/**
	 * The Spring application context.
	 *
	 */
	@SuppressWarnings("unused")
	private ApplicationContext context;

	/**
	 * The service being tested, injected by Spring.
	 *
	 */
	@Autowired
	protected ThesiscommitteeService service;

	/**
	 * Instantiates a new ThesiscommitteeServiceTest.
	 *
	 */
	public ThesiscommitteeServiceTest() {
		setupRequestContext();
	}

	/**
	 * Operation Unit Test
	 * Return all Thesiscommittee entity
	 * 
	 */
	@Test
	public void findAllThesiscommittees() {
		// TODO: JUnit - Populate test inputs for operation: findAllThesiscommittees 
		Integer startResult = 0;
		Integer maxRows = 0;
		List<Thesiscommittee> response = null;
		response = service.findAllThesiscommittees(startResult, maxRows);
		// TODO: JUnit - Add assertions to test outputs of operation: findAllThesiscommittees
	}

	/**
	 * Operation Unit Test
	 * Save an existing Thesiscommittee entity
	 * 
	 */
	@Test
	public void saveThesiscommittee() {
		// TODO: JUnit - Populate test inputs for operation: saveThesiscommittee 
		Thesiscommittee thesiscommittee = new edu.unf.cen6940.domain.Thesiscommittee();
		service.saveThesiscommittee(thesiscommittee);
	}

	/**
	 * Operation Unit Test
	 */
	@Test
	public void findThesiscommitteeByPrimaryKey() {
		// TODO: JUnit - Populate test inputs for operation: findThesiscommitteeByPrimaryKey 
		Integer thesisCommitteeId = 0;
		Thesiscommittee response = null;
		response = service.findThesiscommitteeByPrimaryKey(thesisCommitteeId);
		// TODO: JUnit - Add assertions to test outputs of operation: findThesiscommitteeByPrimaryKey
	}

	/**
	 * Operation Unit Test
	 * Save an existing Faculty entity
	 * 
	 */
	@Test
	public void saveThesiscommitteeFacultyByChair() {
		// TODO: JUnit - Populate test inputs for operation: saveThesiscommitteeFacultyByChair 
		Integer thesisCommitteeId_1 = 0;
		Faculty related_facultybychair = new edu.unf.cen6940.domain.Faculty();
		Thesiscommittee response = null;
		response = service.saveThesiscommitteeFacultyByChair(thesisCommitteeId_1, related_facultybychair);
		// TODO: JUnit - Add assertions to test outputs of operation: saveThesiscommitteeFacultyByChair
	}

	/**
	 * Operation Unit Test
	 * Load an existing Thesiscommittee entity
	 * 
	 */
	@Test
	public void loadThesiscommittees() {
		Set<Thesiscommittee> response = null;
		response = service.loadThesiscommittees();
		// TODO: JUnit - Add assertions to test outputs of operation: loadThesiscommittees
	}

	/**
	 * Operation Unit Test
	 * Delete an existing Faculty entity
	 * 
	 */
	@Test
	public void deleteThesiscommitteeFacultyByChair() {
		// TODO: JUnit - Populate test inputs for operation: deleteThesiscommitteeFacultyByChair 
		Integer thesiscommittee_thesisCommitteeId = 0;
		Integer related_facultybychair_facultyId = 0;
		Thesiscommittee response = null;
		response = service.deleteThesiscommitteeFacultyByChair(thesiscommittee_thesisCommitteeId, related_facultybychair_facultyId);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteThesiscommitteeFacultyByChair
	}

	/**
	 * Operation Unit Test
	 * Save an existing Faculty entity
	 * 
	 */
	@Test
	public void saveThesiscommitteeFacultyByCommitteeMember1() {
		// TODO: JUnit - Populate test inputs for operation: saveThesiscommitteeFacultyByCommitteeMember1 
		Integer thesisCommitteeId_2 = 0;
		Faculty related_facultybycommitteemember1 = new edu.unf.cen6940.domain.Faculty();
		Thesiscommittee response = null;
		response = service.saveThesiscommitteeFacultyByCommitteeMember1(thesisCommitteeId_2, related_facultybycommitteemember1);
		// TODO: JUnit - Add assertions to test outputs of operation: saveThesiscommitteeFacultyByCommitteeMember1
	}

	/**
	 * Operation Unit Test
	 * Save an existing Faculty entity
	 * 
	 */
	@Test
	public void saveThesiscommitteeFacultyByCommitteeMember3() {
		// TODO: JUnit - Populate test inputs for operation: saveThesiscommitteeFacultyByCommitteeMember3 
		Integer thesisCommitteeId_3 = 0;
		Faculty related_facultybycommitteemember3 = new edu.unf.cen6940.domain.Faculty();
		Thesiscommittee response = null;
		response = service.saveThesiscommitteeFacultyByCommitteeMember3(thesisCommitteeId_3, related_facultybycommitteemember3);
		// TODO: JUnit - Add assertions to test outputs of operation: saveThesiscommitteeFacultyByCommitteeMember3
	}

	/**
	 * Operation Unit Test
	 * Delete an existing Faculty entity
	 * 
	 */
	@Test
	public void deleteThesiscommitteeFacultyByCommitteeMember4() {
		// TODO: JUnit - Populate test inputs for operation: deleteThesiscommitteeFacultyByCommitteeMember4 
		Integer thesiscommittee_thesisCommitteeId_1 = 0;
		Integer related_facultybycommitteemember4_facultyId = 0;
		Thesiscommittee response = null;
		response = service.deleteThesiscommitteeFacultyByCommitteeMember4(thesiscommittee_thesisCommitteeId_1, related_facultybycommitteemember4_facultyId);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteThesiscommitteeFacultyByCommitteeMember4
	}

	/**
	 * Operation Unit Test
	 * Delete an existing Thesiscommittee entity
	 * 
	 */
	@Test
	public void deleteThesiscommittee() {
		// TODO: JUnit - Populate test inputs for operation: deleteThesiscommittee 
		Thesiscommittee thesiscommittee_1 = new edu.unf.cen6940.domain.Thesiscommittee();
		service.deleteThesiscommittee(thesiscommittee_1);
	}

	/**
	 * Operation Unit Test
	 * Delete an existing Faculty entity
	 * 
	 */
	@Test
	public void deleteThesiscommitteeFacultyByCommitteeMember1() {
		// TODO: JUnit - Populate test inputs for operation: deleteThesiscommitteeFacultyByCommitteeMember1 
		Integer thesiscommittee_thesisCommitteeId_2 = 0;
		Integer related_facultybycommitteemember1_facultyId = 0;
		Thesiscommittee response = null;
		response = service.deleteThesiscommitteeFacultyByCommitteeMember1(thesiscommittee_thesisCommitteeId_2, related_facultybycommitteemember1_facultyId);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteThesiscommitteeFacultyByCommitteeMember1
	}

	/**
	 * Operation Unit Test
	 * Delete an existing Thesis entity
	 * 
	 */
	@Test
	public void deleteThesiscommitteeThesises() {
		// TODO: JUnit - Populate test inputs for operation: deleteThesiscommitteeThesises 
		Integer thesiscommittee_thesisCommitteeId_3 = 0;
		Integer related_thesises_thesisId = 0;
		Thesiscommittee response = null;
		response = service.deleteThesiscommitteeThesises(thesiscommittee_thesisCommitteeId_3, related_thesises_thesisId);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteThesiscommitteeThesises
	}

	/**
	 * Operation Unit Test
	 * Delete an existing Faculty entity
	 * 
	 */
	@Test
	public void deleteThesiscommitteeFacultyByCommitteeMember3() {
		// TODO: JUnit - Populate test inputs for operation: deleteThesiscommitteeFacultyByCommitteeMember3 
		Integer thesiscommittee_thesisCommitteeId_4 = 0;
		Integer related_facultybycommitteemember3_facultyId = 0;
		Thesiscommittee response = null;
		response = service.deleteThesiscommitteeFacultyByCommitteeMember3(thesiscommittee_thesisCommitteeId_4, related_facultybycommitteemember3_facultyId);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteThesiscommitteeFacultyByCommitteeMember3
	}

	/**
	 * Operation Unit Test
	 * Delete an existing Faculty entity
	 * 
	 */
	@Test
	public void deleteThesiscommitteeFacultyByCommitteeMember5() {
		// TODO: JUnit - Populate test inputs for operation: deleteThesiscommitteeFacultyByCommitteeMember5 
		Integer thesiscommittee_thesisCommitteeId_5 = 0;
		Integer related_facultybycommitteemember5_facultyId = 0;
		Thesiscommittee response = null;
		response = service.deleteThesiscommitteeFacultyByCommitteeMember5(thesiscommittee_thesisCommitteeId_5, related_facultybycommitteemember5_facultyId);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteThesiscommitteeFacultyByCommitteeMember5
	}

	/**
	 * Operation Unit Test
	 * Save an existing Faculty entity
	 * 
	 */
	@Test
	public void saveThesiscommitteeFacultyByCommitteeMember2() {
		// TODO: JUnit - Populate test inputs for operation: saveThesiscommitteeFacultyByCommitteeMember2 
		Integer thesisCommitteeId_4 = 0;
		Faculty related_facultybycommitteemember2 = new edu.unf.cen6940.domain.Faculty();
		Thesiscommittee response = null;
		response = service.saveThesiscommitteeFacultyByCommitteeMember2(thesisCommitteeId_4, related_facultybycommitteemember2);
		// TODO: JUnit - Add assertions to test outputs of operation: saveThesiscommitteeFacultyByCommitteeMember2
	}

	/**
	 * Operation Unit Test
	 * Save an existing Faculty entity
	 * 
	 */
	@Test
	public void saveThesiscommitteeFacultyByCommitteeMember5() {
		// TODO: JUnit - Populate test inputs for operation: saveThesiscommitteeFacultyByCommitteeMember5 
		Integer thesisCommitteeId_5 = 0;
		Faculty related_facultybycommitteemember5 = new edu.unf.cen6940.domain.Faculty();
		Thesiscommittee response = null;
		response = service.saveThesiscommitteeFacultyByCommitteeMember5(thesisCommitteeId_5, related_facultybycommitteemember5);
		// TODO: JUnit - Add assertions to test outputs of operation: saveThesiscommitteeFacultyByCommitteeMember5
	}

	/**
	 * Operation Unit Test
	 * Save an existing Thesis entity
	 * 
	 */
	@Test
	public void saveThesiscommitteeThesises() {
		// TODO: JUnit - Populate test inputs for operation: saveThesiscommitteeThesises 
		Integer thesisCommitteeId_6 = 0;
		Thesis related_thesises = new edu.unf.cen6940.domain.Thesis();
		Thesiscommittee response = null;
		response = service.saveThesiscommitteeThesises(thesisCommitteeId_6, related_thesises);
		// TODO: JUnit - Add assertions to test outputs of operation: saveThesiscommitteeThesises
	}

	/**
	 * Operation Unit Test
	 * Return a count of all Thesiscommittee entity
	 * 
	 */
	@Test
	public void countThesiscommittees() {
		Integer response = null;
		response = service.countThesiscommittees();
		// TODO: JUnit - Add assertions to test outputs of operation: countThesiscommittees
	}

	/**
	 * Operation Unit Test
	 * Delete an existing Faculty entity
	 * 
	 */
	@Test
	public void deleteThesiscommitteeFacultyByCommitteeMember2() {
		// TODO: JUnit - Populate test inputs for operation: deleteThesiscommitteeFacultyByCommitteeMember2 
		Integer thesiscommittee_thesisCommitteeId_6 = 0;
		Integer related_facultybycommitteemember2_facultyId = 0;
		Thesiscommittee response = null;
		response = service.deleteThesiscommitteeFacultyByCommitteeMember2(thesiscommittee_thesisCommitteeId_6, related_facultybycommitteemember2_facultyId);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteThesiscommitteeFacultyByCommitteeMember2
	}

	/**
	 * Operation Unit Test
	 * Save an existing Faculty entity
	 * 
	 */
	@Test
	public void saveThesiscommitteeFacultyByCommitteeMember4() {
		// TODO: JUnit - Populate test inputs for operation: saveThesiscommitteeFacultyByCommitteeMember4 
		Integer thesisCommitteeId_7 = 0;
		Faculty related_facultybycommitteemember4 = new edu.unf.cen6940.domain.Faculty();
		Thesiscommittee response = null;
		response = service.saveThesiscommitteeFacultyByCommitteeMember4(thesisCommitteeId_7, related_facultybycommitteemember4);
		// TODO: JUnit - Add assertions to test outputs of operation: saveThesiscommitteeFacultyByCommitteeMember4
	}

	/**
	 * Autowired to set the Spring application context.
	 *
	 */
	@Autowired
	public void setContext(ApplicationContext context) {
		this.context = context;
		((DefaultListableBeanFactory) context.getAutowireCapableBeanFactory()).registerScope("session", new SessionScope());
		((DefaultListableBeanFactory) context.getAutowireCapableBeanFactory()).registerScope("request", new RequestScope());
	}

	/**
	 * Sets Up the Request context
	 *
	 */
	private void setupRequestContext() {
		MockHttpServletRequest request = new MockHttpServletRequest();
		ServletRequestAttributes attributes = new ServletRequestAttributes(request);
		RequestContextHolder.setRequestAttributes(attributes);
	}
}
